/**
 * Author: Dmitry Ustimov
 * Date: 5/31/13
 * Time: 8:13 PM
 */

package com.gmail.dmitryustimov.ms.java7.mediator.classic.work.demo.col10event10;

import java.math.BigDecimal;

public class ConcreteColleague6 extends AbstractColleague {

    private BigDecimal sum = BigDecimal.valueOf(0);

    public ConcreteColleague6(String name, Mediator mediator) {
        super(name, mediator);
    }

    public void makeEvent() {
        mediator.process(new Event1("C6E1"), this);
        mediator.process(new Event2("C6E2"), this);
        mediator.process(new Event3("C6E3"), this);
        mediator.process(new Event4("C6E4"), this);
        mediator.process(new Event5("C6E5"), this);
        mediator.process(new Event6("C6E6"), this);
        mediator.process(new Event7("C6E7"), this);
        mediator.process(new Event8("C6E8"), this);
        mediator.process(new Event9("C6E9"), this);
        mediator.process(new Event10("C6E10"), this);
    }

    @Override
    public void process(Event event, Colleague colleague) {
        if (event instanceof Event1) {
            process((Event1)event);
        }
        if (event instanceof Event2) {
            process((Event2)event);
        }
        if (event instanceof Event3) {
            process((Event3)event);
        }
        if (event instanceof Event4) {
            process((Event4)event);
        }
        if (event instanceof Event5) {
            process((Event5)event);
        }
        if (event instanceof Event6) {
            process((Event6)event);
        }
        if (event instanceof Event7) {
            process((Event7)event);
        }
        if (event instanceof Event8) {
            process((Event8)event);
        }
        if (event instanceof Event9) {
            process((Event9)event);
        }
        if (event instanceof Event10) {
            process((Event10)event);
        }
    }

    private void process(Event1 event) {
        sum.add(BigDecimal.valueOf(1));
    }

    private void process(Event2 event) {
        sum.add(BigDecimal.valueOf(2));
    }

    private void process(Event3 event) {
        sum.add(BigDecimal.valueOf(3));
    }

    private void process(Event4 event) {
        sum.add(BigDecimal.valueOf(4));
    }

    private void process(Event5 event) {
        sum.add(BigDecimal.valueOf(5));
    }

    private void process(Event6 event) {
        sum.add(BigDecimal.valueOf(6));
    }

    private void process(Event7 event) {
        sum.add(BigDecimal.valueOf(7));
    }

    private void process(Event8 event) {
        sum.add(BigDecimal.valueOf(8));
    }

    private void process(Event9 event) {
        sum.add(BigDecimal.valueOf(9));
    }

    private void process(Event10 event) {
        sum.add(BigDecimal.valueOf(10));
    }
}

